<template>
	<view>
		<bg-video></bg-video>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true"><block slot="backText"></block>
			<block slot="content">卡券录入</block>
		</cu-custom>
		<view class="container">
			<view class="cu-form-group margin-top">
				<view class="title text-green">
					<text class="cuIcon-all"></text>
					<text class="margin-left">卡号</text>
				</view>
				<input placeholder="请输入序列号" v-model="voucherRecord.uuId" name="input"></input>
			</view>
			<view class="cu-form-group margin-top">
				<view class="title text-orange">
					<text class="cuIcon-keyboard"></text>
					<text class="margin-left">密码</text>
				</view>
				<input placeholder="请输入序列号" v-model="voucherRecord.password" name="input"></input>
			</view>
			<view class="padding flex  flex-direction">
				<button @tap="conversion" class="cu-btn bg-blue lg">确定</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data: function() {
			return {
				state: {},
				voucherRecord: {
					uuId: "",
					password: "",
				}
			}
		},
		onLoad:function(){
			this.state = this.common.getState();
		},
		onShow:function(){
			this.state = this.common.getState();
		},
		methods: {
			conversion: function() {
				let self = this;
				this.voucherRecord.clientId = this.state.autor.store_client.clientId;
				this.http.put({
					url: "/client/voucher-record/conversion",
					param: self.voucherRecord
				}).then(function(res) {
					uni.showModal({
					    title: '提示',
					    content: "兑换成功，可前往我的会员中查看！",
						showCancel: false,
					    success: function (res) {
					        if (res.confirm) {
								uni.navigateBack({});
					        } 
					    }
					});
					
				});
			}
		}
	}
</script>

<style>
</style>
